<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <button>按钮</button>
  <script>
    document.querySelector('button').onclick = function () {
      var uname = prompt('请输入账号：（必须为英文字母）')
      var password = parseInt(prompt('请输入数字：（必须为数字）'))
      if ((/[a-zA-z]+/).test(uname) && (/[0-9]+/).test(password)) {
        alert('登录成功')
      } else {
        alert('失败')
      }
    }
  </script>
</body>

</html>